﻿using Knlght.Model.news;
using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;

namespace Knlght.Mappings
{
    public class SysNewsTypeMapping : EntityTypeConfiguration<NewsType>
    {
        public SysNewsTypeMapping()
        {
            // 设置表名
            this.ToTable("Sys" + nameof(NewsType));
            //设置主键
            this.HasKey(p => p.Id);
            //忽略列映射
            this.Ignore(p => p.Nodes);
            //不更新
            //this.Property(t => t.AddTime).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Computed);
            // 设置属性的类型和长度
            this.Property(p => p.Name).HasColumnType("NVarchar").HasMaxLength(500);

        }           
    }
}
